import request from '@/utils/request'

// 分页
export function pagingSupplier(query) {
  return request({
    url: '/user/villageSupplier/paging',
    method: 'get',
    params: query
  })
}

// 获取供应商
export function getVillageSupplier(supplierId) {
  return request({
    url: '/user/villageSupplier/getVillageSupplier',
    method: 'get',
    params: { supplierId }
  })
}

// 供应商列表
export function listSupplier(query) {
  return request({
    url: '/user/villageSupplier/list',
    method: 'get',
    params: query
  })
}

/**
 * 保存
 * @param data
 */
export function saveSupplier(data) {
  return request({
    url: '/user/villageSupplier/save',
    method: 'post',
    data: data
  })
}

/**
 * 保存资质信息
 * @param data
 */
export function saveSupplierQualification(data) {
  return request({
    url: '/user/villageSupplier/saveQualification',
    method: 'post',
    data: data
  })
}

/**
 * 批量启用
 * @param data
 */
export function batchUpdateStatus(status, supplierIds) {
  return request({
    url: '/user/villageSupplier/batchUpdateStatus',
    method: 'post',
    params: { status: status, supplierIds: supplierIds }
  })
}

/**
 * 启用、禁用
 */
export function updateStatus(status, supplierId) {
  return request({
    url: '/user/villageSupplier/updateStatus',
    method: 'post',
    params: { status: status, supplierId: supplierId }
  })
}

/**
 * 更新资质审核状态
 */
export function updateApproveStatus(query) {
  return request({
    url: '/user/villageSupplier/updateApproveStatus',
    method: 'post',
    params: query
  })
}

/**
 * 删除
 * @param data
 */
export function deleteSupplier(supplierId) {
  return request({
    url: '/user/villageSupplier/delete',
    method: 'post',
    params: { supplierId }
  })
}
